<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head></h:head>

    <body>
        <h:form id="form">
            <p:commandButton id="Guardar" value="Confirmar Toma de Lista" action="#{tableBean.guardar}" icon="ui-icon-disk" update="multiCars"/>

            <p:dataTable id="multiCars" var="car" value="#{tableBean.cars}" paginator="true" rows="10" 
                         selection="#{tableBean.selectedCars}" rowKey="#{car.codigo}">  



                <f:facet name="header">  
                    Checkbox Based Selection  
                </f:facet>  
                <p:column selectionMode="multiple" style="width:2%" />  
                <p:column headerText="Codigo" style="width:25%">  
                    <h:outputText value=  "#{car.codigo}"   />  
                </p:column>  
                <p:column headerText="Nombre" style="width:25%">  
                    <h:outputText value=   "#{car.nombre}"   />  
                </p:column>
                <f:facet name="footer">  
                    <p:commandButton id="multiViewButton" value="View" icon="ui-icon-search"  
                                     update=":form:displayMulti" oncomplete="multiCarDialog.show()"/>  
                </f:facet>  
            </p:dataTable>  
            <p:dialog id="multiDialog" header="Car Detail" widgetVar="multiCarDialog"  
                      height="300" showEffect="fade" hideEffect="explode">  

                <p:dataList id="displayMulti" value="#{tableBean.selectedCars}" var="selectedCar">  
                    Codigo: #{selectedCar.codigo}, Nombre: #{selectedCar.nombre}  
                </p:dataList>  

            </p:dialog>
        </h:form>  
    </body>
</html>
